using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using database;
using System.Data;
using System.Configuration;

/// <summary>
/// Summary description for AutoComplete
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[System.Web.Script.Services.ScriptService] 
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class AutoComplete : System.Web.Services.WebService
{
    [WebMethod]
    public string[] GetTagsList(string prefixText)
    {
        database.database db = new database.database();
        DataSet ds = new DataSet();

        ds = db.SelectRows(db.connection(), "select tags_name from tags where tags_name like '" + prefixText + "%'");
        string[] TagsName = new string[ds.Tables[0].Rows.Count];
        int i = 0;
        try
        {
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                TagsName.SetValue(dr["tags_name"].ToString(), i);
                i++;
            }
        }
        catch
        { }

        return TagsName;
    }

}

